package com.ali.ttt.webSocket.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.net.UnknownHostException;

/**
 * @Author : yuxl
 * @create 2024/7/5 5:09 PM
 */
@Configuration
@ConditionalOnProperty(name = "netty.websocket.enable", havingValue = "true")
public class ServerStarter {

    @Resource
    private WebSocketServer nettyServer;

    @PostConstruct
    public void run() throws UnknownHostException {
        nettyServer.start();
    }
}
